package com.onstar.cn.framework.network;

/**
 * Network request framework config file.
 * 
 * @author 7828wc
 * 
 */
public class NetworkConfig {
	/**
	 * Reuqest is https?<br/>
	 * true or false.
	 */
	private boolean isHttps = false;
	/**
	 * The time interval timing request
	 */
	private int time;
	/**
	 * Connect time out
	 */
	private int timeout = 30000;

	/**
	 * Callback key
	 */
	private int key;

	/**
	 * request charset
	 */
	private String charset;

	private static NetworkConfig defaultConfig = new NetworkConfig() {
		{
			setCharset("UTF-8");
			setTime(30 * 1000);
		}
	};

	public static NetworkConfig defaultConfig() {
		return defaultConfig;
	}

	public boolean isHttps() {
		return isHttps;
	}

	public void setHttps(boolean isHttps) {
		this.isHttps = isHttps;
	}

	public int getTime() {
		return time;
	}

	public void setTime(int time) {
		this.time = time;
	}

	public int getTimeout() {
		return timeout;
	}

	public void setTimeout(int timeout) {
		this.timeout = timeout;
	}

	public int getKey() {
		return key;
	}

	public void setKey(int key) {
		this.key = key;
	}

	public String getCharset() {
		if (charset == null) {
			return defaultConfig().charset;
		}
		return charset;
	}

	public void setCharset(String charset) {
		this.charset = charset;
	}

}
